<link rel="stylesheet" type="text/css" href="{$_G['URL']['EDUCATION_STATIC_PATH']}/css/style.css">
<link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/open/libs/weui/0.4.3/weui.min.css">
<script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
<link rel='stylesheet' type='text/css' href='https://res.wx.qq.com/connect/zh_CN/htmledition/style/wap_err1a9853.css'>
<script src="{$_G['URL']['HEXIAO_CSS']}js/jquery.js"></script>
<script src="{$_G['URL']['YX2020_CSS']}js/md5.js?v=1"></script>

<style>
    .baoming_head{
        height: 6.62rem;
        padding: 0.12rem;
    }
    .baoming_head ul{
        background: none;
    }
    .baoming_head ul li {
        height: 100%;
        color: #000;
        width: 20%;
        line-height: 1;
        float: left;
        text-align: center;
        overflow: hidden;
        margin-top: 6px;
    }
    .baoming_head ul li img{
        height: 60%;
        width: auto;
    }
    .orderList>div{
        overflow: unset;
    }
    .rewardList {
        background-color: #F5F6F7;
        padding-bottom: .08rem;
    }
    .rewardChose span {
        width: 100%;
    }
    .rewardChose span.cur:after {
        width: 3.69rem;
        left: 30%;
    }
    .welfareImg {
        width: 2.18rem;
        height: 2.18rem;
        border: 1px solid #b3aaaa;
    }
    .welfareTxt {
        width: 3.98rem !important;
    }
    .welfareTxt span {
        margin-top: .06rem;
    }
    .welfareTxt p {
        font-size: .3rem;
    }
    .welfareTxt p i {
        font-size: .24rem;
    }
    .welfareTxt p i b {
        font-size: .34rem;
    }
    .welfareList li a.welfareState {
        height: .44rem;
        line-height: .44rem;
        margin-top: 0;
        /*width: 1.6rem;*/
        background: linear-gradient(90deg, #FEC207 -6.48%, #FEAB06 97.21%);
    }
    .welfareList li a.welfareState:after {
        width: .32rem;
        height: .32rem;
        top: .04rem;
    }
    .right_div {
        display: flex;
        line-height: .62rem;
        height: .62rem;
        justify-content: space-between;
        align-items: center;
        margin-top: .04rem;
    }
    .welfareTxt .p2 {
        background-color: #FF600A;
        padding: 4px 8px;
        color: #ffffff;
        height: .4rem;
        line-height: .44rem;
        margin-top: .06rem;
        border-radius: 6px;
        font-size: .25rem;
        font-weight: 500;
    }
    .welfareTxt .used {
        background-color: #EFEFEF;
        color: #706F6F;
    }
    .welfareList li a.welfareState2 {
        height: .66rem !important;
        line-height: .66rem !important;
    }
    .welfareList li a.welfareState2:after {
        width: .38rem !important;
        height: .38rem !important;
        top: .12rem !important;
    }
    .right_div2 {
        width: 4.2rem;
    }
    .pp2 {
        width: 3.86rem;
    }
    @-webkit-keyframes shine {
        0% {
            transform: scale(1);
            background-position-x: 200%;
        }

        50% {
            transform: scale(1.2);
            background-position-x: 0%;
        }

        100% {
            transform: scale(1);
            background-position-x: -200%;

        }
    }

    @keyframes shine {
        0% {
            transform: scale(1);
            background-position-x: 200%;
        }

        50% {
            transform: scale(1.3);
            background-position-x: 0%;
        }

        80% {
            transform: scale(1.1);
            background-position-x: 0%;
        }

        100% {
            transform: scale(1);
            background-position-x: -200%;
        }
    }
    .div1 {
        z-index: 201;
        width: 40px;
        height: 40px;
        position: fixed;
        right: 4%;
        bottom: 20%;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-content: center;
        align-items: center;
        animation: shine 2s infinite;
        animation-timing-function: linear;
        transform: scale(1);
    }

    .schoolAlt .schollTitle {
        position: sticky;
        top: 0;
        color: #fff;
        background: #ffffff;
        background: linear-gradient(90deg, #FF8E0D -4.33%, #FF5005 96.22%);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
        border-radius: .44rem .44rem 0 0;
        text-align: center;
        z-index: 199;
    }
    .shadow{
        width:100%;
        height:100%;
        position:absolute;
        left:0;
        top:0;
        z-index:31;
        background-color:#000;
        opacity:0.6;
        display:none;
    }
    .popup{
        width: 80%;
        height: 40%;
        position: fixed;
        right: 10%;
        margin: auto;
        bottom: 40%;
        border-radius: 10%;
        display: flex;
        background-color:#fff;
        justify-content: center;
        align-content: center;
        align-items: center;
        z-index: 200;

    }
    .online{
        z-index: 208;
        padding-bottom: .32rem;
        display: block;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
        background: #ffffff;
        width: 6rem;
        border-radius: .48rem;
        /*border: 3px solid #FD8E0B;*/
    }
    .online h2{
        border-bottom: 1px solid #EDEEF0;
        text-align: center;
        position: relative;
        line-height: 1.1rem;
        font-size: .36rem;
        background: linear-gradient(90deg, #FF8E0D -4.33%, #FF5005 96.22%);
        color: #ffffff;
        border-radius: 20px 20px 0 0;
    }
    .online h2 .closeOnlie {
        display: block;
        background: url(https://css2020.yixuan.net/2020css/yx2020/images/closebtn2.png) center no-repeat;
        width: .48rem;
        height: .48rem;
        background-size: 100% auto;
        position: absolute;
        right: .32rem;
        top: .32rem;
    }
    .contactEwm{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    .contactEwm img {
        width: 3rem;
        margin: 0 auto .24rem;
        pointer-events: auto;
        display: block;
    }
    .contactEwm p {
        text-align: center;
        font-size: .24rem;
        line-height: .32rem;
        color: #666666;
        margin-top: 10px;
    }
    .contactInfor {
        background: #F5F6F7;
        width: 5.36rem;
        margin: .32rem auto 0;
        border-radius: .28rem;
        padding: .32rem;
    }
    .get_div{
        display: flex;
        justify-content: center;
        margin-top: 10px;
    }
    .iknow{
        display: flex;
        background: linear-gradient(90deg, #FF8E0D -4.33%, #FF5005 96.22%);
        width: 180px;
        padding: 10px;
        justify-content: center;
        border-radius: 20px;
        color: #ffffff;
        font-size: 16px;
        font-weight: 500;
    }
    .online .gift_name{
        font-size: 18px;
    }
    .rewardChose{
        background: url("http://img2020.yixuansoft.cn/images/2/2023/10/PYShyY3Zf424aFY9Znhy9Gn29UYg6f.jpg/99.jpg") center no-repeat;
        /*background: url("http://img2020.yixuansoft.cn/images/2/2023/10/OodDb8Hbd3yj3YD05Gh8dfjvJHbdH8.jpg/99.jpg") center no-repeat;*/
        /*background: url("http://img2020.yixuansoft.cn/images/2/2023/10/FEthEWeg34HKtNOU3w0tKwkHnnt33i.jpg/99.jpg") center no-repeat;*/
        background-size: 100% auto;
        height: 100px;
    }
    .gift_share{
        width: 300px;
        height: 240px;
        position: fixed;
        top: 1%;
        right: 1%;
        z-index: 32;
    }
</style>

<!--弹窗领取-->
<div class="online"  id="unclaimed_html"  style="display: none;">

</div>

<div id="gift_share" class="gift_share" style="display: none;">
    <img src="https://css2020.yixuan.net/2020css/yx2020/images/fenxiao_gitft.png">
</div>


<!--默认顶部、中部、底部-->
<div class="rewardList" style="display: none;" id="yemian">
    <div class="rewardChose">
    </div>
    <div class="welfareList">
        <ul id="welfarelist_li">
        </ul>
    </div>
</div>
<!--悬浮按钮-->
<div class="div1" style="display: none;" id="tanchuang" onclick="eject()">
    <img style=" height: 100%;width: 100%;" id="buoy_img" src="https://css2020.yixuan.net/2020css/education/images/icon3.png">
</div>
<!--弹窗做在下侧-->
<div class="show_alert" >
    <div class="schoolAlt" style="max-height: 80vh;z-index: 32;">
        <div class="schollTitle" style="background: linear-gradient(90deg,#FF8E0D -5.72%,#FF5005 85.87%)">
            我的福利
            <span class="closeScholl"></span>
        </div>
        <div class="rewardList">
            <div class="welfareList">
                <ul id="welfarelist_li1">
                </ul>
            </div>
        </div>
    </div>
</div>
<!--遮罩层-->
<div class="shadow"  onclick="smask()"></div>
<script>
    var is_load = false;
    var config = [];
    var unclaimed = [];
    $(document).ready(function () {
        loadBaseInfo();
    });

    function loadBaseInfo() {
        var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"gift.index.main"));}';
        if (!is_load) {
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: postUrl,
                success: function (res) {
                    var data = res.data;
                    var welfarelist_li = data.html.welfarelist_li;
                    unclaimed = data.unclaimed;
                    config = data.config;
                    $('#buoy_img').attr('src', config.buoy_img);
                    if (config.show_mode == 4) {
                        $("#welfarelist_li1").append(decode(welfarelist_li));
                        $('#tanchuang').show();
                    } else {
                        if(welfarelist_li==undefined||welfarelist_li==''||welfarelist_li==null){}else{
                            $("#welfarelist_li").append(decode(welfarelist_li));
                            $('#yemian').show();
                        }
                    }
                    //礼品弹出
                    if(unclaimed==undefined||unclaimed==''||unclaimed==null){}else{
                        unclaimed_open()
                    }
                }
            });
        }
    }
    //弹窗领取开启
    function unclaimed_open(){
        let index;
        let html;
        for(index in unclaimed) {
            if(unclaimed[index].state==-1){
                html = unclaimed[index].html;
                $("#unclaimed_html").append(decode(html));
                $(".online").css({'display':'block'});
                $(".shadow").css({'display':'block'});
                unclaimed[index].state = 1;
                return false;
            }
        }


    }
    //弹窗领取关闭
    function unclaimed_close(){
        smask()
    }

    function eject() {
        $(".show_alert").children().eq(0).animate({'bottom': 0}, 500);
        $(".shadow").css({'display':'block'});
    }

    $('.show_alert').on('click', '.closeScholl', function () {
        smask();
    })
    function smask(){
        $(".shadow").css({'display':'none'});
        $("#gift_share").hide();
        $('.schoolAlt').animate({'bottom': '-110%'}, 500)
        $(".online").hide();

        $("#unclaimed_html").empty();
        unclaimed_open();
    }
    function qr_code(url,gift_recordid){
        var html = '<h2>核销码<span class="closeOnlie" onclick="unclaimed_close()"></span></h2><div class="contactEwm"><img id="qr_img" src="" style="pointer-events:auto;" ><div class="gift_name"></div><p id="shiwu">实物礼品仅可选择一个兑换</p></div><div class="get_div" ><div class="iknow"  onclick="unclaimed_close()">请让工作人员扫码核销</div></div>';
        $("#unclaimed_html").append(html);
        $(".online").css({'display':'block'});
        $(".shadow").css({'display':'block'});
        if(config.exchange_mode==2) {
            $("#shiwu").hide();
        }
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: url,
            data:{gift_recordid:gift_recordid},
            success: function (res) {
                $('.schoolAlt').animate({'bottom': '-110%'}, 500)
                var data = res.data;
                var qr_img = data.qrimg;
                var qrurl = '{$_G['URL']['QRURLNEW']}';
                qrurl = qrurl + urlencode(qr_img);
                $("#qr_img").attr("src",qrurl);
            }
        });
    }
    function urlencode (str) {
        str = (str + '').toString();
        return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
        replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
    }
    function  wxdialog(){
        //显示提示语弹窗
        $(".weui-dialog").css({'display':'block'});
    } (function(){
        //先判断是否为微信浏览器
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == 'micromessenger') {
            //重写confirm方法，confirm()方法重写，不能传多余参数
            window.confirm = function (message) {
                var iframe = document.createElement("IFRAME");
                iframe.style.display = "none";
                iframe.setAttribute("src", 'data:text/plain,');
                document.documentElement.appendChild(iframe);
                var alertFrame = window.frames[0];
                var result = alertFrame.window.confirm(message);
                iframe.parentNode.removeChild(iframe);
                return result;
            };
            //alert隐藏网址
            window.alert = function(name){
                var iframe = document.createElement("IFRAME");
                iframe.style.display="none";
                iframe.setAttribute("src", 'data:text/plain,');
                document.documentElement.appendChild(iframe);
                window.frames[0].window.alert(name);
                iframe.parentNode.removeChild(iframe);
            }
        }
    })();
    function receive(e) {
        var gift_recordid = e.getAttribute("data-gift_recordid");
        var status = e.getAttribute("data-status");
        var freeze = e.getAttribute("data-freeze");
        var number = e.getAttribute("data-number");
        var classify = e.getAttribute("data-classify");
        if(status==-1){
            if(number==1&&classify=='tuan_gift'){
                show_info(1)
                return ;
            }
            smask();
            $(".shadow").show();
            $("#gift_share").show();
        }else if(status==1){
            if(gift_recordid==undefined||gift_recordid==''||gift_recordid==null){
                layer.msg('参数错误');
            }
            if(freeze != 1){
                layer.msg('冻结中，请先完成条件再核销');
                return false;
            }
            var url = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"gift.index.qr_code"));}';
            if(status==1){
            //hexiao
                if(config.exchange_mode==1) {
                    var result = confirm("礼品只能核销一个！确认核销该礼品吗？");
                    if (result) {
                        qr_code(url,gift_recordid);
                        // window.location.href = url;
                        return false;
                    }
                }else{
                    qr_code(url,gift_recordid);
                    // window.location.href = url;
                    return false;
                }
            }
        }
        return ;

    }
</script>
















